package com.lengtouzai.databaseexp.security;

import com.lengtouzai.databaseexp.entity.FriendGroup;
import com.lengtouzai.databaseexp.entity.User;
import io.jmix.security.model.EntityAttributePolicyAction;
import io.jmix.security.model.EntityPolicyAction;
import io.jmix.security.role.annotation.EntityAttributePolicy;
import io.jmix.security.role.annotation.EntityPolicy;
import io.jmix.security.role.annotation.ResourceRole;
import io.jmix.securityflowui.role.annotation.ViewPolicy;

@ResourceRole(name = "AnonymousRule", code = AnonymousRuleRole.CODE)
public interface AnonymousRuleRole {
    String CODE = "anonymous-rule";

    @ViewPolicy(viewIds = "exp_RegisterView")
    void register();

    @EntityPolicy(entityClass = User.class, actions = EntityPolicyAction.ALL)
    @EntityAttributePolicy(entityClass = User.class, attributes = "*", action = EntityAttributePolicyAction.MODIFY)
    @EntityPolicy(entityClass = FriendGroup.class, actions = EntityPolicyAction.ALL)
    @EntityAttributePolicy(entityClass = FriendGroup.class, attributes = "*", action = EntityAttributePolicyAction.MODIFY)
    void entity();
}